/*--------------------------------------------------------------------------------------------------
Yatak Operation System Project Copyright 2012-2013
Author : Ilya Churaev
Started : 3 Sep 2012		Updated : 12 Jan 2013
File Name : tyoes.h			Purpose : Define some types
--------------------------------------------------------------------------------------------------*/
#ifndef _YATAK_TYPES_H
#define _YATAK_TYPES_H

#ifdef __cplusplus
extern "C" {
#endif

#include <posix/posix_types.h>

typedef __kernel_ino_t		ino_t;
typedef __kernel_mode_t		mode_t;
typedef __kernel_nlink_t	nlink_t;
typedef __kernel_off_t		off_t;
typedef __kernel_pid_t		pid_t;
typedef __kernel_tid_t		tid_t;
typedef __kernel_daddr_t	daddr_t;
typedef __kernel_timer_t	timer_t;
typedef __kernel_clockid_t	clockid_t;

typedef __kernel_uid_t		uid_t;
typedef __kernel_gid_t		gid_t;
typedef __kernel_intid_t	intid_t;

#ifndef __cplusplus
typedef enum
{
	false = 0,
	true = 1
} bool;
#endif

/* colors */
#define __BLACK 0
#define __BLUE 1
#define __GREEN 2
#define __CYAN 3
#define __RED 4
#define __MAGENTA 5
#define __BROWN 6
#define __LIGHT_GREY 7
#define __DARK_GREY 8
#define __LIGHT_BLUE 9
#define __LIGHT_GREEN 10
#define __LIGHT_CYAN 11
#define __LIGHT_RED 12
#define __LIGHT_MAGENTA 13
#define __LIGHT_BROWN 14
#define __WHITE 15

typedef unsigned short int word;
typedef unsigned long qword;
typedef unsigned int dword;
typedef unsigned char byte;

typedef unsigned char uint8;
typedef signed char int8;
typedef char sint8;

typedef unsigned short uint16;
typedef signed short int16;
typedef short sint16;

typedef unsigned int uint32;
typedef signed int int32;
typedef int sint32;

typedef unsigned long long uint64;
typedef signed long long int64;
typedef long long sint64;

typedef unsigned short int usint;
typedef unsigned long ulong;
typedef short int sint;

/* quads, deprecated in favor of 64 bit int types */
typedef	int64	quad_t;
typedef	uint64	u_quad_t;
typedef	quad_t *	qaddr_t;

#ifdef __x86_64__
	typedef uint64 size_t;
#else
	typedef uint32 size_t;
#endif

typedef bool mutex_t;

typedef uint32 state_t;


// s_floor.c
typedef unsigned long ulong;
typedef unsigned long u32;
typedef unsigned short u16;
typedef unsigned char u8;

typedef unsigned long long uint64_t;
typedef unsigned long long u_int64_t;
typedef unsigned long uint32_t;
typedef unsigned long u_int32_t;
typedef unsigned short uint16_t;
typedef unsigned short u_int16_t;
typedef unsigned char uint8_t;
typedef unsigned char u_int8_t;

typedef  long __int32_t;
typedef unsigned long __uint32_t;

typedef unsigned long long u_quad_t;    /* quads */
typedef long long quad_t;
typedef quad_t * qaddr_t;
typedef unsigned long u_int;
typedef unsigned long uint;

typedef long long int64_t;
typedef long int32_t;
typedef short int16_t;
typedef char int8_t;


#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0

#define __BEGIN_DECLS
#define __END_DECLS
#define __dead
#define __far

#define __HI(x) *(1+(int*)&x)
#define __LO(x) *(int*)&x

#define __P(a) a
#define CHAR_BIT        8       	/* max # of bits in a "char" */

#define EXTRACT_WORDS(i0, i1, x) \
    i0 =  __HI(x); \
    i1 =  __LO(x);

#define INSERT_WORDS(x, i0, i1) \
    __HI(x) = i0; \
    __LO(x) = i1; 

#define _BEGIN_STD_C
#define _END_STD_C

#define _EXFUN(a,b) a b
    
typedef unsigned long long u64;

#define FLT_MAX  1E+37
#define DBL_MAX  1E+37
#define LDBL_MAX 1E+37  

# ifndef INFINITY
#  define INFINITY (__builtin_inff())
# endif

#define NUM 3
#define NAN 2
#define INF 1

#define 	M_PI   3.14159265358979323846	/* pi */
#define __PI 3.14159265358979323846
#define __SQRT_HALF 0.70710678118654752440
#define __PI_OVER_TWO 1.57079632679489661923132

typedef const union
{
  long l[2];
  double d;
} udouble;

typedef const union
{
  long l;
  float f;
} ufloat;

extern double BIGX;
extern double SMALLX;

typedef int DWORD;
#ifdef __cplusplus
}
#endif

#endif
